//Hello! This script will close: Stats; Report; GravrStone; PIN settings; Graphics; Quest; Price Check; GE Collection Box; Clan chat Setup; Bank Helper; Audio; Death Items or World map Interface!

//IMPORTANT! If you do have any of these files, mentioned below, in AntiBan or AntiRandom folder, then DELETE them!
//DELETE these from AntiBan or AntiRandom folder if you haven't yet!---> "StatCloser.java & StatCloser.class" ; "ReportCloser.java & ReportCloser.class" ; "GraphicsCloser.java & GraphicsCloser.class" ; "CloseWorldMap.java & CloseWorldMap.class" ; "CloseGrave.java & CloseGrave.class" ; "BankHelpCloser.java & BankHelpCloser.class" ; "AudioCloser.java & AudioCloser.class"
import com.speljohan.rsbot.script.Random;
import com.speljohan.rsbot.script.wrappers.RSInterface;

/**
 * Offical Threads in Forum: http://www.rsbot.org/vb/showthread.php?t=5099
 */

public class CloseAllInterface extends Random {

	@Override
	public boolean activateCondition() {
		if (!isLoggedIn()) { // Isn't logged in
			return false;
		}
		if (RSInterface.getInterface(755).getChild(3).isValid()) { // World map
			return true;
		}
		if (RSInterface.getInterface(743).getChild(20).isValid()) { // Audio
			return true;
		}
		if (RSInterface.getInterface(767).getChild(10).isValid()) { // Bank Help
			return true;
		}
		if (RSInterface.getInterface(499).getChild(29).isValid()) { // Stats
			return true;
		}
		if (RSInterface.getInterface(594).getChild(48).isValid()) { // Report
			return true;
		}
		if (RSInterface.getInterface(742).getChild(25).isValid()) { // Graphics
			return true;
		}
		if (RSInterface.getInterface(275).getChild(8).isValid()) { // Quest
			return true;
		}
		if (RSInterface.getInterface(206).getChild(16).isValid()) { // Price
			// Check
			return true;
		}
		if (RSInterface.getInterface(266).getChild(11).isValid()) { // Grave
			return true;
		}
		if (RSInterface.getInterface(109).getChild(13).isValid()) { // GE
			// Collection
			// Box
			return true;
		}
		if (RSInterface.getInterface(102).getChild(13).isValid()) { // Death
			// items
			return true;
		}
		if (RSInterface.getInterface(590).getChild(3).isValid()) { // Clan Setup
			return true;
		}
		if (RSInterface.getInterface(14).getChild(3).isValid()) { // PIN
			// settings
			return true;
		}

		return false;
	}

	@Override
	public String getAuthor() {
		return "HeyyamaN";
	}

	@Override
	public String getName() {
		return "Interface Closer";
	}

	@Override
	public double getVersion() {
		return 1.3;
	}

	@Override
	public int loop() {
		if (RSInterface.getInterface(755).isValid()) {
			atInterface(RSInterface.getInterface(755).getChild(3)); // World map
			return random(500, 900);
		}

		if (RSInterface.getInterface(743).isValid()) {
			atInterface(RSInterface.getInterface(743).getChild(20)); // Audio
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(767).isValid()) {
			atInterface(RSInterface.getInterface(767).getChild(10)); // Bank
			// Help
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(499).isValid()) {
			atInterface(RSInterface.getInterface(499).getChild(29)); // Stats
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(594).isValid()) {
			atInterface(RSInterface.getInterface(594).getChild(48)); // Report
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(742).isValid()) {
			atInterface(RSInterface.getInterface(742).getChild(25)); // Graphics
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(275).isValid()) {
			atInterface(RSInterface.getInterface(275).getChild(8)); // Quest
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(206).isValid()) {
			atInterface(RSInterface.getInterface(206).getChild(16)); // Price
			// Check
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(266).isValid()) {
			atInterface(RSInterface.getInterface(266).getChild(11)); // Grave
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(109).isValid()) {
			atInterface(RSInterface.getInterface(109).getChild(13)); // GE
			// Collection
			// Box
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(102).isValid()) {
			atInterface(RSInterface.getInterface(102).getChild(13)); // Death
			// items
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(590).isValid()) {
			atInterface(RSInterface.getInterface(590).getChild(3)); // Clan
			// Setup
			wait(random(500, 900));
		}
		if (RSInterface.getInterface(14).isValid()) {
			atInterface(RSInterface.getInterface(14).getChild(3)); // PIN
			// settings
			wait(random(500, 900));
		}

		return -1;
	}
}